<form id="fm_order" action="./m.php?frm=action&mdl=index" method="post" target="eBody">
	<input type="hidden" name="formAction" value="{$_act.frm}.{$_act.mdl}_{$_act.do}" />
	<input type="hidden" name="id" id="id" value="{$orderinfo.id}" />
	<input type="hidden" name="sn" id="sn" value="{$orderinfo.sn}" />
	<input type="hidden" name="subAction" id="subAction" value="" />
	<table border="0" align="center" cellpadding="0" cellspacing="1" class="data_form">
		<caption>基本信息</caption>
		<tbody>
			<tr>
				<th style="width:160px;">订单号：</th>
				<td style="width:240px;">{$orderinfo.sn}</td>
				<th style="width:160px;">订单状态：</th>
				<td>{$orderinfo.statename}，{$orderinfo.payment_statename}，{$orderinfo.delivery_statename}</td>
			</tr>
			<tr>
				<th>下单用户：</th>
				<td>{$orderinfo.username}</td>
				<th>下单时间：</th>
				<td>{$orderinfo.addtime}</td>
			</tr>
			<tr>
				<th>支付方式：</th>
				<td>{$paymentinfo.name}</td>
				<th>付款时间：</th>
				<td>{if $orderinfo.payment_state > 0}{$orderinfo.payment_time}{else}{$orderinfo.payment_statename}{/if}</td>
			</tr>
			<tr>
				<th>配送方式：</th>
				<td>{$deliveryinfo.name}</td>
				<th>发货时间：</th>
				<td>{if $orderinfo.delivery_state > 0}{$orderinfo.delivery_time}{else}{$orderinfo.delivery_statename}{/if}</td>
			</tr>
		</tbody>
		<tfoot>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
			</tr>
		</tfoot>
	</table>
	<br />
	<br />
	<table border="0" align="center" cellpadding="0" cellspacing="1" class="data_form">
		<caption>收货人信息</caption>
		<tbody>
			<tr>
				<th style="width:160px;">收货人：</th>
				<td style="width:240px;">{$addrinfo.consignee}</td>
				<th style="width:160px;">电子邮件：</th>
				<td>{$addrinfo.email}</td>
			</tr>
			<tr>
				<th>地址：</th>
				<td>{$addrinfo.province_name}{$addrinfo.city_name}{$addrinfo.area_name}{$addrinfo.address}</td>
				<th>邮编：</th>
				<td>{$addrinfo.zipcode}</td>
			</tr>
			<tr>
				<th>电话：</th>
				<td>{$addrinfo.tel}</td>
				<th>手机：</th>
				<td>{$addrinfo.mobile}</td>
			</tr>
			<tr>
				<th>标志性建筑：</th>
				<td>{$addrinfo.consignee}</td>
				<th>最佳送货时间：</th>
				<td>{$addrinfo.besttime}</td>
			</tr>
		</tbody>
		<tfoot>
			<tr>
				<td></td>
				<td>修改收货人信息</td>
				<td></td>
				<td></td>
			</tr>
		</tfoot>
	</table>
	<br />
	<br />
	<table border="0" align="center" cellpadding="0" cellspacing="1" class="data_form">
		<caption>费用信息</caption>
		<tbody>
			<tr>
				<th style="width:160px;">商品总价：</th><td>￥{$orderinfo.goods_cost}</td>
			</tr>
			<tr>
				<th>+ 配送费用：</th><td>￥{$orderinfo.delivery_fee}</td>
			</tr>
			<tr>
				<th>+ 手续费：</th><td>￥{$orderinfo.payment_fee}</td>
			</tr>
			<tr>
				<th>= 应付款金额: </th><td>￥{$orderinfo.cost}</td>
			</tr>
		</tbody>
		<tfoot>
			<tr>
				<td></td>
				<td>修改费用信息</td>
			</tr>
		</tfoot>
	</table>
	<br />
	<br />
	<table align="center" class="data_form">
		<caption>订单商品</caption>
		<thead>
			<tr>
				<th style="width:22px;"><input type="checkbox" title="{$l.selall}/{$l.selnone}" class="poshytip" /></th>
				<th style="width:92px;">商品图片</th>
				<th>商品名称</th>
				<th style="width:100px;">规格</th>
				<th style="width:50px;">重量</th>
				<th style="width:50px;">单价</th>
				<th style="width:50px;">数量</th>
				<th style="width:80px;">小计</th>
				<th style="width:50px;">状态</th>
			</tr>
		</thead>
		<tbody id="goodslist">
			{foreach from=$goodslist item=goods}
			<tr>
				<th>{if $goods.sentnum == '0'}<input type="checkbox" name="list[]" value="{$goods.goodsid}" />{else}--{/if}</th>
				<td><a href="{$goods.url}" title="{$goods.goodsinfo.name}<br />
--------<br />
重量：{$goods.goodsinfo.fweight}{$goods.goodsinfo.weightunit}<br />
库存：{$goods.goodsinfo.quantity}<br />
单价：￥{$goods.goodsinfo.price}" class="poshytip open_frame"><img src="{$_s.up_dir}thumb/92_70/{$goods.goodsinfo.cover}" width="92" height="70" onload="drawImage(this, 92, 70);" /></a></td>
				<td><a href="./m.php?frm=goods&mdl=goods&do=edit&id={$goods.goodsid}" class="open_frame">{$goods.goodsinfo.name}</a></td>
				
				<td>{foreach from=$goods.fspecs item=spec}
						{$spec.name}：{$spec.value}<br />
					{/foreach}</td>
				<td>{$goods.fweight}{$goods.weightunit}</td>
				<td>￥{$goods.price}</td>
				<td>×&nbsp;{$goods.number}</td>
				<td>=&nbsp;￥{$goods.cost}</td>
				<td>{if $goods.sentnum > 0}已发货{else}--{/if}</td>
			</tr>
			{/foreach}
		</tbody>
		<tfoot>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
			</tr>
		</tfoot>
	</table>

	<br />
	<br />
	<a id="cmd"></a>
	<table border="0" align="center" cellpadding="0" cellspacing="1" class="data_form">
		<caption>操作信息</caption>
		
		<tbody>
			<tr>
				<th style="width:160px;">操作备注：</th>
				<td><textarea name="memo" class="textarea" style="width:640px; height:80px;"></textarea><br />
					<span class="red">取消、无效、付款、退款、退货等操作必须输入备注</span></td>
			</tr>
		</tbody>
		<tbody id="express" class="hide">
			<tr>
				<th style="width:160px;"><span class="red">*</span>物流名称：</th>
				<td>{$deliveryinfo.name}</td>
			</tr>
			<tr>
				<th style="width:160px;"><span class="red">*</span>发货单号：</th>
				<td><input type="text" name="express_no" value="" class="input" style="width:240px;" /></td>
			</tr>
			<tr>
				<th style="width:160px;"><span class="red">*</span>快递费：</th>
				<td><input type="text" name="express_fee" value="" class="input" style="width:80px;" />￥</td>
			</tr>
			<tr>
				<th style="width:160px;">给买家留言：</th>
				<td><textarea name="message" class="textarea" style="width:640px; height:80px;"></textarea></td>
			</tr>
		</tbody>
		<tbody>
			<tr>
				<th style="width:160px;">当前可执行操作：</th>
				<td>
					{if $_g._mp_order_order_confirm && $orderinfo.state == 0}
					<input type="button" name="subAction[confirm]" value="确认" class="button" onclick="do_action('confirm');" />
					{/if}
					
					{if $_g._mp_order_order_pay && $orderinfo.state >= 0 && $orderinfo.payment_state < 2}
					<input type="button" name="subAction[pay]" value="付款" class="button" onclick="do_action('pay');" />
					{elseif $orderinfo.payment_state == 2}
					<input type="button" name="subAction[refund]" value="退款" class="button" onclick="do_action('refund');" />
					{/if}
					{if $_g._mp_order_order_prepare && $orderinfo.state >= 0 && $orderinfo.delivery_state == 0}
					<input type="button" name="subAction[prepare]" value="配货" class="button" onclick="do_action('prepare');" />
					{/if}
					{if $_g._mp_order_order_send && $orderinfo.state >= 0 && $orderinfo.delivery_state == 1}
					<input type="button" name="subAction[send]" value="发货" class="button" onclick="do_action('send');" />
					{elseif $orderinfo.delivery_state == 3}
					<input type="button" name="subAction[reback]" value="退货" class="button" onclick="do_action('reback');" />
					{/if}
					{if $_g._mp_order_order_complete && $orderinfo.state >= 0 && $orderinfo.state < 2 && $orderinfo.payment_state == 2 && $orderinfo.delivery_state >= 2}
					<input type="button" name="subAction[complete]" value="完成" class="button" onclick="do_action('complete');" />
					{/if}
					{if $_g._mp_order_order_service && $orderinfo.state == 2 && $orderinfo.payment_state == 2 && $orderinfo.delivery_state >= 2}
					<input type="button" name="subAction[service]" value="售后" class="button" onclick="do_action('service');" />
					{/if}
					&nbsp;&nbsp;&nbsp;&nbsp;
					{if $_g._mp_order_order_cancel && $orderinfo.state < 2 && $orderinfo.payment_state < 2 && $orderinfo.delivery_state < 2}
					<input type="button" name="subAction[cancel]" value="取消" class="button" onclick="do_action('cancel');" />
					{/if}
					{if $_g._mp_order_order_invalid && $orderinfo.state < 2 && $orderinfo.payment_state < 2 && $orderinfo.delivery_state < 2}
					<input type="button" name="subAction[invalid]" value="无效" class="button" onclick="do_action('invalid');" />
					{/if}
					&nbsp;&nbsp;&nbsp;&nbsp;
					{if $_g._mp_order_order_lack && $orderinfo.islack == 0}
					<input type="button" name="subAction[lack]" value="缺货登记" class="button" onclick="do_action('lack');" />
					{/if}
				</td>
			</tr>
			<tr>
				<th>补充说明：</th>
				<td><ul class="multi">
						<li>确认：未付款的订单需要此操作，已付款、已配货或已发货的订单则自动确认；</li>
						<li>付款：一般情况下货到付款的订单才需要此操作，或当在线支付成功但没有成功通知时；<span class="red">[*需备注]</span></li>
						<li>退款：...；<span class="red">[*需备注]</span></li>
						<li>配货：通知买家商品正在配货；</li>
						<li>发货：商品成功通过快递或其他物流配送出去后，通知买家商品已配送，做好收货准备；</li>
						<li>退货：...；</li>
						<li>完成：完成所有流程后，正常结束；</li>
						<li>取消：暂时无法完成的订单，有恢复操作，比如缺货、买家需要再考虑；<span class="red">[*需备注]</span></li>
						<li>无效：无法完成的订单，无恢复操作，比如恶意下单；<span class="red">[*需备注]</span></li>
						<li>缺货登记：当配货出现库存不足时，登记后可查看详细缺货商品信息；</li>
					</ul></td>
			</tr>
			
		</tbody>
	</table>

</form>



<script type="text/javascript" language="JavaScript" charset="utf-8">
<!--
	var id				= parseInt('{$orderinfo.id}');
	var state			= parseInt('{$orderinfo.state}');
	var payment_state	= parseInt('{$orderinfo.payment_state}');
	var delivery_state	= parseInt('{$orderinfo.delivery_state}');

	{literal}
	jQuery(function($){
		$('#fm_order input[type="button"][name="pay"]').click(function(){

		});

		if(state > 0 && delivery_state == 1){
			$('#express').show('slow');
		}
	});

	function do_action(action){
		//debugger;
		var fm = $('#fm_order');
		var memo = $.trim(fm.find('textarea[name="memo"]').val());
		var msg = '';
		$('#subAction').val(action);
		switch(action){
			case 'confirm':
				if(state > 0){
					return showmsg_info('当前订单已经确认过了');
				}
				break;

			case 'cancel':
				if(payment_state == 1){
					msg = '当前订单买家已经付款（未成功），确定要取消？';
				}else if(payment_state == 2){
					return showmsg_info('当前订单已经确认付款成功，不可取消!');
				}else if(delivery_state == 2){
					return showmsg_info('当前订单已经发货，不可取消!');
				}
				if(memo == ''){
					return showmsg_warning('请输入备注信息<br />比如：缺货');
				}
				if(msg == ''){
					msg = '确定要取消本订单？';
				}
				return myconfirm(msg, {submit: confirm_action});
				break;

			case 'invalid':
				if(payment_state == 1){
					msg = '当前订单买家已经付款（未成功），确定要设为无效？';
				}else if(payment_state == 2){
					return showmsg_info('当前订单已经付款成功，不可设为无效!');
				}else if(delivery_state == 2){
					return showmsg_info('当前订单已经发货，不可设为无效!');
				}
				if(memo == ''){
					return showmsg_warning('请输入备注信息<br />比如：恶意下单');
				}
				if(msg == ''){
					msg = '确定要设置本订单为无效？';
				}
				return myconfirm(msg, {submit: confirm_action});
				break;

			case 'pay':
				if(state == -1 || state == -2){
					return showmsg_info('当前订单已经取消或无效，不可设为已付款!');
				}else if(payment_state == 2){
					return showmsg_info('当前订单已经确认付款成功');
				}
				if(memo == ''){
					return showmsg_warning('请输入备注信息<br />比如：货到付款');
				}
				return myconfirm('您确认已经收到买家的货款？', {submit: confirm_action});
				break;

			case 'prepare':
				if(state == -1 || state == -2){
					return showmsg_info('当前订单已经取消或无效，不可配货!');
				}else if(state == 0){
					msg = '当前订单还未确认，确定要配货？'; 
				}else if(payment_state < 2){
					msg = '当前订单还未付款，确定要配货？';
				}
				if(msg != ''){
					return myconfirm(msg, {submit: confirm_action});
				}
				break;

			case 'send':
				var express = $('#express');
				if(express.css('display') == 'none'){
					express.show('slow');
					return false;
				}
				var express_no = $.trim(fm.find('input[type="text"][name="express_no"]').val());
				var express_fee = $.trim(fm.find('input[type="text"][name="express_fee"]').val());
				var message = $.trim(fm.find('textarea[name="message"]').val());
				var errmsg = [];
				if(state == -1 || state == -2){
					return showmsg_info('当前订单已经取消或无效，不可发货!');
				}else if(state == 0){
					errmsg = '当前订单还未确认，确定要发货？';
				}else if(payment_state < 2){
					errmsg = '当前订单还未付款，确定要发货？';
				}
				// 如果订单里面有两个以上商品，则需要钩选已发货的商品
				if($('#goodslist input[type="checkbox"][name="list[]"]').size() > 1){
					if($('#goodslist input[type="checkbox"][name="list[]"]:checked').size() == 0){
						errmsg.push('请钩选可发货的商品');
					}
				}else{
					$('#goodslist input[type="checkbox"][name="list[]"]').attr('checked', true);
				}
				if(express_no == ''){
					errmsg.push('请输入快递单号');
				}
				if(express_fee == ''){
					errmsg.push('请输入快递费');
				}
				if(errmsg.length > 0){
					return showmsg_warning(errmsg.join('<br />'));
				}
				if(errmsg != ''){
					return myconfirm(errmsg, {submit: confirm_action});
				}
				break;
			case 'complete':
				if(state == -1 || state == -2){
					return showmsg_info('当前订单已经取消或无效，无法完成!');
				}else if(state == 0){
					return showmsg_info('当前订单还未确认，不可设为完成？');
				}else if(payment_state < 2){
					return showmsg_info('当前订单还未付款，不可设为完成？');
				}else if(delivery_state < 2){
					return showmsg_info('当前订单还未发货，不可设为完成？');
				}
				return myconfirm('确认当前订单已经正常完成？', {submit: confirm_action});
				break;
			case 'lack':
				if(state == -1 || state == -2){
					return showmsg_info('当前订单已经取消或无效，无需登记!');
				}else if(state == 0){
					msg = '当前订单还未确认，';
				}else if(payment_state < 2){
					msg = '当前订单还未付款，';
				}else if(payment_state >= 2){
					return showmsg_info('当前订单已发货，无需登记!');
				}
				return myconfirm(msg+'确认当前订单缺货并进行缺货登记？', {submit: confirm_action});
				break;
		}
		$('#fm_order').trigger('submit');
	}

	function confirm_action(e, v, m, f){
		if(v == true){
			$('#fm_order').trigger('submit');
		}
	}
	{/literal}
-->
</script>
